package vn.fpt.fsoft.coreframework;

import java.awt.Graphics2D;
import java.util.ArrayList;
import java.util.List;

public class ProjectileManager {

	private List<Projectile> projectiles = new ArrayList<Projectile>();

	public void addProjectile(Player player) {
		Projectile projectile = new Projectile(player.getCenterPlayer(),
				player.getDirection(), player);
		projectiles.add(projectile);
	}

	public void update() {
		for (int i = projectiles.size() - 1; i >= 0; i--) {
			projectiles.get(i).fire();
		}
	}

	public void draw(Graphics2D g) {
		for (int i = 0; i < projectiles.size(); i++) {
			projectiles.get(i).draw(g);
		}
	}
}
